package com.young.common.client.ums;

import com.young.interfaces.ums.model.User;

/**
 * ums客户端上下文
 * @author imrookie
 * @date 2018/9/30
 */
public class UmsClientContext {

    //登录用户的ThreadLocal
    public static ThreadLocal<User> userThreadLocal = new ThreadLocal<User>();

    /**
     * 设置当前登录用户
     * @param user
     */
    public static void setLoginUser(User user){
        userThreadLocal.set(user);
    }

    /**
     * 获取当前登录用户
     * @return
     */
    public static User getLoginUser(){
        return userThreadLocal.get();
    }

    public static void removeLoginUser(){
        userThreadLocal.remove();
    }
}
